package com.info33.platform.system.controller;

import com.info33.platform.common.mvc.controller.BaseController;
import com.info33.platform.common.mvc.vo.Result;
import com.info33.platform.doc.entity.DocFileDetail;
import com.info33.platform.system.entity.SysConfigImg;
import com.info33.platform.system.service.SysConfigImgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author admin
 */
@RestController
@RequestMapping("/SysConfigImg")
@Api(tags = "系统 - 配置 - 图片日志")
public class SysConfigImgController extends BaseController<SysConfigImgService, SysConfigImg> {

    private final SysConfigImgService sysConfigImgService;

    @Autowired
    public SysConfigImgController(SysConfigImgService sysConfigImgService) {
        super(sysConfigImgService);
        this.sysConfigImgService = sysConfigImgService;
    }

    @PostMapping(value = "/upload")
    @ApiOperation(value = "单文件上传")
    public Result<List<DocFileDetail>> businessUpload(
            @RequestParam(value = "file") MultipartFile[] multipartFiles,
            String type) {
        return sysConfigImgService.upload(multipartFiles, type, getTenantId());
    }

}